<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let arr = [30, 40, [30, 50], [1, 2, 2], [3, 4, 5], [11, 12, [13, 14, 12]]];
    let flatArr = arr.flat(Infinity);
    console.log(flatArr);
    let flatArrSet = new Set(arr.flat(Infinity));
    console.log(flatArrSet);;
    let result = Array.from(flatArrSet).sort((a, b) => a -b );
    console.log(result);
  </script>
</body>
</html>
